﻿
function init() {
    $.ajaxHandler({
        url: App_Config.TadongUrl + "/AjaxMappingHandler.aspx",
        urlType: "GetStructTablePro",
        model: function () { return $.getPara('dicttypeid');},
        success: function (data) {
            if (data) {
                for (var key in data) {
                    if ($('#' + key).length > 0) {
                        if (key == "T_CAT") 
                            $('#' + key).val(data[key]);
                        if (key == "T_FIELD")
                            $('#' + key).val(data[key]);
                    }
                }
            }
        }
    });
    $('#save').bind('click', function () { save(); });
}
function exit() {
    parent.$.closePage();
}
//保存
function save() {
    if ($('#T_CAT').val() == '') {
        alert(lang.Business_in_can_not_be_empty);
        return;
    }
    if ($('#T_FIELD').val() == '') {
        alert(lang.field_can_not_be_empty);
        return;
    }

    $.ajaxHandler({
        url: App_Config.TadongUrl + "/AjaxMappingHandler.aspx",
        urlType: "EditStructTablePro",
        model: function () {
            var obj = {};
            obj.T_CAT = $('#T_CAT').val();
            obj.T_FIELD = $('#T_FIELD').val();
            obj.T_CODE = $.getPara('dicttypeid');
            return $.toJSON(obj);
        },
        success: function (data) {
            if (data) {
                alert(lang.edit_success);
                
                parent.$.closePage();

            }
        }
    });
}





